package OrdersSystem;

import java.sql.Time;
import java.util.Date;
import java.util.ArrayList;


/**
 * 
 * This class inherits the features of the RegisteredUser class.
 * and represents the Customer, who interacts with the system. 
 * 
 * @author iSolutions-Team Orders
 *
 */
public class Customer extends RegisteredUser
{
	/**
	 * Represents the contents of an alert message.
	 */
	private int externalCompanyID;

	/**
	 * A Constructor for the class
	 *
	 * @param userID the number, which uniquely identifies an user. 
	 * @param name the name of the customer.
	 * @param surname the second name of the customer.
	 * @param address an object of the class, which contains the address of the User.
	 * @param exteralCompanyID the id of the customer if they belong to an external company.
	 * 
     */	
	public Customer(int userID, String name, String surname,
			ContactDetails address, int externalCompanyID) 
	{
		super(userID, name, surname, address);
		this.externalCompanyID = externalCompanyID;
		
	}
	
	/**
	 * A method used for the submission of a single order by the customer.
	 *
	 * @param deliveryAddressAlt the alternative address, to which the customer desires to receive the delivery. 
	 * @param deliveryDate the desired date from the customer, on which they want the order to be delivered. 
	 * @param deliveryTime the desired time, when the customer wants the order to be delivered.
	 * @param productID the number which uniquely represents a product.
	 * @param productQuantity the number which specifies the quantity of the product.
	 * @param comments additional remarks made by the customer about the delivery of their ordered products.
	 * 
     */
	public String submitSingleOrder(String deliveryAddressAlt, Date deliveryDate, Time deliveryTime,
			 						int productID, float productQuantity, String comments)
	{
		Order newOrder = new Order(getUserID(), deliveryAddressAlt, externalCompanyID, deliveryDate, deliveryTime,
									productID, productQuantity, comments);		
		return newOrder.submitOrder();
	}
	
	/**
	 * An implementation of an abstract method defined in the RegisteredUser class.
	 * It is used for returning the details for the orders made by the specific Customer in the system.
	 * 
	 * @return ArrayList<Order> a list of the successful orders made by the particular customer.
	 * 
	 */
	public ArrayList<Order> viewHistoryTracking() {
        HistoryTracking history = new HistoryTracking(getUserID());
        return history.getOrderHistory();               
	}
	
	/**
	 * A method used for the submission of multiple orders in the system,
	 * which contents are specified inside a file.
	 * 
	 */
	public String submitMassOrders()
	{
		return "Not implemented";
    }	
}	
